import Vue from 'vue'
import Router from 'vue-router'
import mailbox from './module/mailbox'
import userInfo from './module/userInfo'
import organization from './module/organization'
import application from './module/application'
import mental from './module/mental'
import activity from './module/activity'
import calendar from './module/calendar'
import recommend from './module/recommend'

Vue.use(Router)

const router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/register')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login')
    },
    {
      path: '/401',
      name: '401',
      component: () => import('@/views/error/401')
    },
    {
      path: '/500',
      name: '500',
      component: () => import('@/views/error/500')
    },
    {
      path: '/404',
      name: '404',
      component: () => import('@/views/error/404')
    },
    {
      path: '/',
      redirect: '/home',
      component: () => import('@/views/layout'),
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('@/views/home/index')
        },
        {
          path: '/mailbox',
          name: 'mailbox',
          component: () => import('@/views/mailbox/index')
        },
        {
          path: '/user',
          name: 'user',
          component: () => import('@/views/user/index')
        },
      ]
    },
    ...userInfo,
    ...mailbox,
    ...organization,
    ...application,
    ...mental,
    ...activity,
    ...calendar,
    ...recommend,
    {
      path: '*',
      name: 'notfund',
      component: () => import('@/views/error/404')
    }
  ]

})

export default router
